package com.atguigu.ggkt.vod.controller;

import com.atguigu.ggkt.result.Result;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RestController
@RequestMapping(value="/admin/vod/user")
//@CrossOrigin//解决跨域问题
public class UserLoginController {

    /**
     * 登录
     * @return
     */
    @PostMapping("login")
    public Result login(){
        HashMap<String, Object> map = new HashMap<>();
        /** {code: 20000, data: {token: "admin-token"}}
                code: 20000
                data: {token: "admin-token"}
                    token: "admin-token" */
        map.put("token", "admin-token");
        return Result.ok(map);
    }

    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("info")
    public Result info(){
        HashMap<String, Object> map = new HashMap<>();
        /** {code: 20000, data: {roles: ["admin"], introduction: "I am a super administrator",…}}
                 code: 20000
                 data: {roles: ["admin"], introduction: "I am a super administrator",…}
                 avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"【头像】
                 introduction: "I am a super administrator"
                 name: "Super Admin"
                 roles: ["admin"]
                 0: "admin" */
        map.put("roles", "admin");
        map.put("introduction", "I am a super administrator");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        map.put("name", "Super Admin");
        return Result.ok(map);
    }

}
